//package com.mofe.zxy.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.http.SessionCreationPolicy;
//import org.springframework.security.jwt.crypto.sign.MacSigner;
//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
//import org.springframework.security.oauth2.provider.token.TokenStore;
//import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
//import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
//
///**
// * @ClassName: ResourceServerConfig
// * @Description: ResourceServerConfig
// * @Create by: ZhangXuYuan
// * @Date: 2022/4/13 15:32
// */
//
////@Configuration
//public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
//
//    private String signKey = "123";
//
//    @Autowired
//    private ExtractAttrFromTokenConverter converter;
//
//
//    @Override
//    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
////        super.configure(resources);
//
//        resources.resourceId("resource_crm").tokenStore(tokenStore()).stateless(true);
//    }
//
//    @Override
//    public void configure(HttpSecurity http) throws Exception {
////        super.configure(http);
//        http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
//                .and().authorizeRequests().antMatchers("/user/**").authenticated()
//                .anyRequest().permitAll().and().cors().disable();
//
//    }
//
//    public TokenStore tokenStore() {
//        JwtTokenStore jwtTokenStore = new JwtTokenStore(jwtAccessTokenConverter());
//        return jwtTokenStore;
//    }
//
//    public JwtAccessTokenConverter jwtAccessTokenConverter() {
//        JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
//        jwtAccessTokenConverter.setSigningKey(signKey);
//        jwtAccessTokenConverter.setVerifier(new MacSigner(signKey));
//        jwtAccessTokenConverter.setAccessTokenConverter(converter);
//        return jwtAccessTokenConverter;
//    }
//}
